#!/usr/bin/env bash


port=""
service=""
size=10
ips=""


function usage() {
        echo "USAGE:"
        echo "-p:port"
        echo "-s:service"
        echo "-i:ips"
        exit -1
}


while [ $# -gt 0 ]
do
        case "$1" in
                -p)
                        port=$2
                        shift
                        ;;
                -s)
                        service=$2
                        shift
                        ;;
                -l)
                        size=$2
                        shift
                        ;;
                -i)
                        ips=$2
                        shift
                        ;;
                -h)
                        usage
                        exit
                        ;;
                -*)
                        echo "Invalid option: $1"
                        usage
                        exit 2
                        ;;
                *)
                        break
                        ;;
        esac
        shift
done


cmd="sh ../api/dispatch.sh $port $service $size $ips"
eval $cmd
echo $cmd


